<?php
namespace Common\Model;

use Think\Model;

class AuthGroupAccessModel extends Model
{
    public function addAccess($user_id, $group_id)
    {
        $access = $this->where(array("uid" => $user_id))->find();
        if ($access) {
            $access["group_id"] = $group_id;
            $this->save($access);
        } else {
            $this->add(array("uid" => $user_id, "group_id" => $group_id));
        }
    }

    public function delAccess($user_id)
    {
        $this->where(array("uid" => $user_id))->delete();
    }
}